<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition   xmlns="http://www.w3.org/1999/xhtml"
			      xmlns:h="http://java.sun.com/jsf/html"
				  xmlns:p="http://primefaces.org/ui"
			      xmlns:f="http://java.sun.com/jsf/core"
			      xmlns:ui="http://java.sun.com/jsf/facelets"
			      > 
			      
<p:panel id="SMpanel" header="Filtration Parameters" style="margin-bottom:10px;font-size:14px;">   
    <p:panelGrid columns="5">
      
        <h:outputText value="Country: *" /> 
        <p:selectOneMenu style="width:180px" id="SMRcountries" value="#{stocksMatchingManagedBean.country}" required="true" requiredMessage="Required">
        	<f:selectItem itemLabel="--Select Country--" itemValue="" />  
            <f:selectItems value="#{servicesManagedBean.allCountriesList}" /> 
            <p:ajax update="SMRDistributors" listener="#{stocksMatchingManagedBean.updateDistributorsList}"/> 
        </p:selectOneMenu>
        
        <h:outputText value="Distributor: *" />  
        <p:selectOneMenu style="width:120px" id="SMRDistributors" value="#{stocksMatchingManagedBean.distributor}" required="true" requiredMessage="Required">    
         <f:selectItems value="#{stocksMatchingManagedBean.distList}" />
        </p:selectOneMenu> 
              
            
        <p:commandButton value="Call" update="StocksMatching @form" actionListener="#{stocksMatchingManagedBean.callMatchingProcedure}"/>
            
        <h:outputText value="From: *" />  
 		<p:calendar id="SMRfrom"  styleClass="calendarFilter" pattern="dd-MMM-yy" value="#{stocksMatchingManagedBean.from_date}" showOn="button" required="true" requiredMessage="Required">
        </p:calendar>
        
        <h:outputText value="To: *" />
        <p:calendar id="SMRto"  styleClass="calendarFilter" pattern="dd-MMM-yy" value="#{stocksMatchingManagedBean.to_date}" showOn="button" required="true" requiredMessage="Required">
        </p:calendar>
 		
 		
 		<h:commandLink>  
        <p:graphicImage value="NWDSAKMS-excel-logo.png" width="30" height="30" title="Export to Excel"  style="border:0;margin-left:5px"/>  
        <p:dataExporter type="xls" target="StocksMatchingDatatable" fileName="Stocks_Matching_#{servicesManagedBean.dateNow}" />  
    	</h:commandLink>              
      </p:panelGrid>  
 </p:panel>  
 
 
 
 <p:panel id="StocksMatching">
 <p:dataTable   id="StocksMatchingDatatable" style="margin-top:5px"
			  	var="matchRow" value="#{stocksMatchingManagedBean.smlist}"
			  	rendered="#{stocksMatchingManagedBean.procedureCalled}"  
              	paginator="true" 
              	rows="30"   
              	paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
              	rowsPerPageTemplate="20,40,60,80" 
              	lazy="true"
              	rowStyleClass="#{matchRow.color}"
              >  
        <f:facet name="header">  
            Matching Report  
        </f:facet> 
        
        <p:column style="background:#FFFFFF">  
        <f:facet name="header">  
            <h:outputText value="Distributor" style="color:black"/>  
        </f:facet> 
            <h:outputText value="#{matchRow.distributorNo}" />  
        </p:column>  
  
        <p:column style="background:#FFFFFF">  
        <f:facet name="header">  
            <h:outputText value="Stock Date" style="color:black"/>  
        </f:facet> 
            <h:outputText value="#{matchRow.stockDate}"/>  
        </p:column>  
  
        <p:column style="background:#DCDCDC">
        <f:facet name="header">  
            <h:outputLabel value="Namehub Value" style="color:black"/>  
        </f:facet> 
            <h:outputText value="#{matchRow.namehubStockValue}" /> 
        </p:column>  
        
        <p:column style="background:#DCDCDC">
        <f:facet name="header">  
            <h:outputLabel value="Chub Value" style="color:black"/>  
        </f:facet> 
            <h:outputText value="#{matchRow.chubStockValue}"/>
        </p:column>
               
        <p:column style="background:#DCDCDC">
        <f:facet name="header">  
            <h:outputLabel value="File Value" style="color:black"/> 
        </f:facet> 
            <h:outputText value="#{matchRow.ftpfileHubStockValue}"/>
        </p:column> 
        
        <p:column style="background:#C8C8C8">
        <f:facet name="header" >  
            <h:outputLabel value="Namehub Volume" style="color:black"/>
        </f:facet> 
            <h:outputText value="#{matchRow.namehubStockVolume}"/>
        </p:column>
        
        <p:column style="background:#C8C8C8">
               <f:facet name="header">  
            <h:outputLabel value="Chub Volume" style="color:black"/>  
        </f:facet> 
            <h:outputText value="#{matchRow.chubStockVolume}" />
        </p:column> 
        
        <p:column style="background:#C8C8C8">
        <f:facet name="header">  
            <h:outputText value="File Volume" style="color:black"/>  
        </f:facet> 
            <h:outputText value="#{matchRow.ftpfileHubStockVolume}" />
        </p:column>
       
   
    </p:dataTable> 
    </p:panel>
</ui:composition>